
#include <p32xxxx.h>
#include <plib.h>

#pragma config FNOSC = PRIPLL
#pragma config POSCMOD = XT
#pragma config FPBDIV = DIV_8
#pragma config FWDTEN = OFF
#pragma config FPLLIDIV = DIV_2
#pragma config FPLLMUL = MUL_20
#pragma config FPLLODIV = DIV_1

#pragma interrup InterruptHandler ipll vector 0

int count;
int DATA;
void InterrupHandler(void)
{
    count++;
    mT2ClearIntFlag();
}

int main(int argc, char** argv)
{
    SYSTEMConfigPerformance(80000000);

    mOSCSetPBDIV(OSC_PB_DIV_8);

    PR2=15;
    T2CON=0x8030;
    mT2SetIntPriority(1);
    INTEnableSystemSingleVectoredInt();
    mT2IntEnable(1);

    while(1)
    {
        if(TXREQ==1){
            TXREQ=0;
        }
       TXB1D1=1;
       DATA=RXB1D1

    }
    return(EXIT_SUCCESS);
}